package edu.ecnu.yt.spring.aop.xml;

import org.aspectj.lang.ProceedingJoinPoint;

public class Audience {
	
	public void somethingHappens(ProceedingJoinPoint jp, String cause) {
		try {
			// 如果使用around则没有必要使用参数参数匹配切点表达式，因为jp可以自带args的查询。
			// System.out.println((String)jp.getArgs()[0]);
			System.out.println("Audience: Something has happened: " + cause);
			// 执行该连接点所具有的实际操作。
			jp.proceed();
			System.out.println("Audience: leaved");
		} catch (Throwable e) {
			System.out.println("Audience: cannot leave!!!");
		}
	}
	
	public void silenceCellPhones() {
		System.out.println("Audience: Silencing cell phones");
	}

	public void takeSeats() {
		System.out.println("Audience: Taking seats");
	}
	
	public void applause() {
		System.out.println("Audience: CLAP CLAP CLAP!!!");
	}
	
	public void demandRefund() {
		System.out.println("Audience: Demanding a refund");
	}
}
